<template>
  <div class="index-task">
    <nut-swiper loop pagination-visible pagination-color="#7ED6C6">
      <nut-swiper-item
        v-for="index in Math.ceil(data.length / 2)"
        :key="index"
        :style="{ height: Taro.pxTransform(200) }"
      >
        <div class="index-task__group">
          <IndexTaskItem :data="data[(index - 1) * 2]" />
          <IndexTaskItem
            v-if="(index - 1) * 2 + 1 < data.length"
            :data="data[(index - 1) * 2 + 1]"
          />
        </div>
      </nut-swiper-item>
    </nut-swiper>
  </div>
</template>

<script lang="ts">
export default {
  name: "index-task",
};
</script>

<script setup lang="ts">
import Taro from "@tarojs/taro";
import IndexTaskItem from "./index-task-item.vue";
import { IMissionItemRes } from "@/apis/types/home";

withDefaults(
  defineProps<{
    data: IMissionItemRes[];
  }>(),
  {
    data: () => [],
  }
);
</script>

<style lang="less">
.index-task {
  width: 100%;
  &__group {
    display: flex;
    align-items: center;
    gap: 16px;
  }
}
</style>
